<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<!-- #include virtual=/inc/action.header.inc.asp -->

<%
	'## 파라미터 변수 선언부
	seq		= Request("seq")
	If seq = "" Then seq = 0 End If 
	
	SQLTitle = "-- ■■■■ 오더 품목 콤보 ■■■■"
	
	'## 검색조건에 따른 조건절 만들기 
	If seq <> "" Then 
		addQuery = " OR A.seq=" & seq
	End If 

	SQL = "SELECT B.compOrderNo, A.compPrdCd, A.compPrdNm, A.amount, A.seq FROM tblCompOrderArticle A LEFT JOIN tblCompOrder B ON A.orderNo=B.orderNo " & _
			"WHERE (A.flag='Y' AND B.flag='Y') " & addQuery & " ORDER BY A.compPrdCd" 

	If xMode="debug" Then 
		Call showDebug(SQLTitle,SQL) 
	End If 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	Response.write "<OrderArticles>" & vbcrlf

	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof
		
			chk = ""
			If Rs("seq") = CInt(seq) Then 
				chk = " SELECTED"
			End If 
			Response.write "	<ArticleList>" & vbcrlf
				Call mkXMLNode("compOrderNo", rs("compOrderNo"), 2)
				Call mkXMLNode("compPrdCd", rs("compPrdCd"), 2)
				Call mkXMLNode("compPrdNm", rs("compPrdNm"), 2)
				Call mkXMLNode("amount", FormatNumber(rs("amount"),0), 2)
				Call mkXMLNode("chk", chk, 2)
				Call mkXMLNode("seq", rs("seq"), 2)
			Response.write "	</ArticleList>" & vbcrlf

		Rs.movenext
		Loop 
	End If
	Response.write "</OrderArticles>" & vbcrlf
'	Call rsWithXML("Save OK!")
%>